package config.initialization;

import org.springframework.context.annotation.Configuration;

/**
 * Created by zhangpingyang on 2020-01-12 23:31
 **/
@Configuration
public class CorsConfig {
//    @Bean
//    public CorsFilter corsFilter() {
//        CorsConfiguration config = new CorsConfiguration();
//        允许所有域名进行跨域调用
//        config.addAllowedOrigin("*");
//        允许跨越发送cookie
//        config.setAllowCredentials(true);
//        放行全部原始头信息
//        config.addAllowedHeader("*");
//        允许所有请求方法跨域调用
//        config.addAllowedMethod("*");
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        source.registerCorsConfiguration("/**", config);
//        return new CorsFilter(source);
//    }
}
